#include <stdio.h>

int strend(char *s, char *t);

int main()
{
  char str1[20] = "hello";
  char str2[20] = "ello";
  if (strend(str1, str2)) {
    printf("str1 contains str2!\n");
  }

  return 0;
}

int strend(char *s, char *t) {
  int tlen = 0;
  // make both s and t to the end
  while (*s++)
    ;
  while (*t++)
    tlen++;

  // decrease pointer to compare per char
  while (*--s == *--t && tlen > 0) {
    tlen--;
  }

  if (tlen == 0) {
    return 1;
  }

  return 0; // otherwise return zero
}
